package com.hpf.lease.common.config;

import jakarta.annotation.Resource;
import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
@ConfigurationProperties(prefix = "minio")
@Data
public class MinioConfig implements InitializingBean {
    private String endpoint;
    private String accessKey;
    private String secretKey;
    private String bucket;
    private String module;
    private List<String> mediaTypes;

    public static String ENDPOINT;
    public static String ACCESS_KEY;
    public static String SECRET_KEY;
    public static String BUCKET;
    public static String MODULE;
    public static List<String> MEDIA_TYPES;

    @Override
    public void afterPropertiesSet() throws Exception {
        ENDPOINT = this.endpoint;
        ACCESS_KEY = this.accessKey;
        SECRET_KEY = this.secretKey;
        BUCKET = this.bucket;
        MODULE = this.module;
        MEDIA_TYPES = this.mediaTypes;
    }
}
